home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / linux / atari / source / source.lzh / atari-linux-0.01pl3 / drivers / char / mouse.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  1.7 KB  |  73 lines

  1. /*
  2.  * linux/kernel/drivers/char/mouse.c
  3.  *
  4.  * Generic mouse open routine by Johan Myreen
  5.  *
  6.  * Based on code from Linus
  7.  *
  8.  * Teemu Rantanen's Microsoft Busmouse support and Derrick Cole's
  9.  *   changes incorporated into 0.97pl4
  10.  *   by Peter Cervasio (pete%q106fm.uucp@wupost.wustl.edu) (08SEP92)
  11.  *   See busmouse.c for particulars.
  12.  *
  13.  * Made things a lot mode modular - easy to compile in just one or two
  14.  * of the mouse drivers, as they are now completely independent. Linus.
  15.  *
  16.  * Amiga mouse support by Michael Rausch
  17.  *
  18.  */
  19.  
  20. #include <linux/fs.h>
  21. #include <linux/errno.h>
  22. #include <linux/mouse.h>
  23. #include <linux/config.h>
  24. #include <linux/kernel.h>
  25. #include <linux/major.h>
  26.  
  27. /*
  28.  * note that you can remove any or all of the drivers by undefining
  29.  * the minor values in <linux/mouse.h>
  30.  */
  31. extern struct file_operations amiga_mouse_fops;
  32.  
  33. extern unsigned long amiga_mouse_init(unsigned long);
  34.  
  35. static int mouse_open(struct inode * inode, struct file * file)
  36. {
  37.     int minor = MINOR(inode->i_rdev);
  38.  
  39.     switch (minor) {
  40. #ifdef CONFIG_AMIGAMOUSE
  41.         case AMIGAMOUSE_MINOR:
  42.                     file->f_op = &amiga_mouse_fops;
  43.                     break;
  44. #endif
  45.         default:
  46.             return -ENODEV;
  47.     }
  48.         return file->f_op->open(inode,file);
  49. }
  50.  
  51. static struct file_operations mouse_fops = {
  52.         NULL,        /* seek */
  53.     NULL,        /* read */
  54.     NULL,        /* write */
  55.     NULL,        /* readdir */
  56.     NULL,        /* select */
  57.     NULL,        /* ioctl */
  58.     NULL,        /* mmap */
  59.         mouse_open,
  60.         NULL        /* release */
  61. };
  62.  
  63. unsigned long mouse_init(unsigned long kmem_start)
  64. {
  65. #ifdef CONFIG_AMIGAMOUSE
  66.     kmem_start = amiga_mouse_init(kmem_start);
  67. #endif
  68.     if (register_chrdev(MOUSE_MAJOR,"mouse",&mouse_fops))
  69.         printk("unable to get major %d for mouse devices\n",
  70.                MOUSE_MAJOR);
  71.     return kmem_start;
  72. }
  73.